<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
<meta name="viewport" content="width=device-width, initial-scale=1"> 
<title>注册</title>
<link rel="stylesheet" type="text/css" href="css/normalize.css" />
<link rel="stylesheet" type="text/css" href="css/demo.css" />
<!--必要样式-->
<link rel="stylesheet" type="text/css" href="css/component.css" />
<!--[if IE]>
<script src="js/html5.js"></script>
<![endif]-->
<script type="text/javascript" src="<%=path%>/js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="<%=path%>/layer/layer.js"></script>
<link rel="stylesheet" href="<%=path%>/layer/theme/default/layer.css" type="text/css"></link>
</head>
<body>
		<div class="container demo-1">
			<div class="content">
				<div id="large-header" class="large-header">
					<canvas id="demo-canvas"></canvas>
					<div class="logo_box">
						<h3>欢迎新用户注册</h3>
						<form action="${pageContext.request.contextPath}/register" method="post">
							<div class="input_outer">
								<span class="u_user"></span>
								<input name="username" class="text" style="color: #FFFFFF !important" type="text" placeholder="请输入账户" id="username">
								<span id="s1">
								</span>
							</div>
							<div class="input_outer">
								<span class="us_uer"></span>
								<input name="password" class="text" style="color: #FFFFFF !important; position:absolute; z-index:100;"value="" type="password" placeholder="请输入密码" id="password">
							</div>
							<div class="input_outer">
								<span class="us_uer"></span>
								<input name="passwords" class="text" style="color: #FFFFFF !important; position:absolute; z-index:100;"value="" type="password" placeholder="重复密码" id="password1">
								<span id="s2">
								</span>
							</div>
							<div class="mb2">
								<input id="register" type="button" class="act-but submit" style="color: #FFFFFF;width: 330px" value="注册">
								<input  type="button" class="act-but submit" style="color: #FFFFFF;width: 330px" value="登录" onclick="window.location='login.jsp'">
							</div>
						</form>
					</div>
				</div>
			</div>
		</div><!-- /container -->
		<script src="js/TweenLite.min.js"></script>
		<script src="js/EasePack.min.js"></script>
		<script src="js/rAF.js"></script>
		<script src="js/demo-1.js"></script>
		<div style="text-align:center;">
</div>
	</body>
	<!--登陆-->
	<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
	<script type="text/javascript">
		//注册验证
		$(function(){
			var name = false;
			var pwd = false;
			//验证用户名是否存在
			$("#username").blur(function(){
				$.get("${pageContext.request.contextPath}/yanzheng",{"username":$("#username").val()},function(data){
					if(data == "ok"){
						name = true;
						$("#s1").html("√");
					}else{
						$("#s1").html("×");
						name = false;
					}
				});				
			});
			//判断密码是否一致
			$("#password1").blur(function(){
				if($("#password").val()==$("#password1").val()){
					pwd = true;
					$("#s2").html("√");
				}else{
					pwd = false;
					$("#s2").html("×");
				}
				
			});
			//注册
			$("#register").click(function(){
				if(name == true && pwd == true){
					$("form").submit();
				}else{
					alert("信息有误");
				}
			});
		})
	</script>
</html>